package br.com.condominio.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.condominio.dao.ResponsavelDAO;
import br.com.condominio.entity.Responsavel;

@Service("responsavelService")
public class ResponsavelService {

	@Autowired
	private ResponsavelDAO dao;

	public List<Responsavel> getAllResponsavels() {
		return dao.findAll();
	}

	public List<Responsavel> getResponsavelsByName(String string) {
		return dao.findByName(string);
	}

	public Responsavel persistResponsavel(Responsavel responsavel) {
		return dao.persist(responsavel);
	}

	public void updateResponsavel(Responsavel responsavel) {
		dao.merge(responsavel);
	}

	public void deleteResponsavel(Responsavel responsavel) {
		dao.remove(responsavel);
	}

	public void setDao(ResponsavelDAO dao) {
		this.dao = dao;
	}

	public Responsavel getResponsavelsById(Integer id) {
		return dao.findById(id);
	}

}
